<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template_dialog.xhtml">
	<ui:define name="head">
		<title>#{breakerActException.breakerAct.stationName}#{breakerActException.breakerAct.breakerName}
			断路器动作分析</title>
		<style>
</style>
	</ui:define>
	<ui:define name="content">
		<p:panelGrid columns="1" style="width:100% !important;"
			rendered="#{breakerActException.breakerAct == null}">
			<f:facet name="header">
				<h:outputText rendered="#{breakerActException.msgType.equals('xhsjyc')}" value="断路器熄弧时间异常"
					style="font-size:18px;" />
				<h:outputText rendered="#{breakerActException.msgType.equals('gzdlgldyc')}" value="故障电流过零异常"
					style="font-size:18px;" />
				<h:outputText rendered="#{breakerActException.msgType.equals('dlqyc')}" value="断路器动作时间异常"
					style="font-size:18px;" />
			</f:facet>
			<h:outputText value="未找到录波文件" style="color:red;" />
		</p:panelGrid>
		<p:panelGrid columns="1" style="width:100% !important;"
			rendered="#{breakerActException.breakerAct != null}">
			<f:facet name="header">
				<h:outputText rendered="#{breakerActException.msgType.equals('xhsjyc')}" value="断路器熄弧时间异常"
					style="font-size:18px;" />
				<h:outputText rendered="#{breakerActException.msgType.equals('gzdlgldyc')}" value="故障电流过零异常"
					style="font-size:18px;" />
				<h:outputText rendered="#{breakerActException.msgType.equals('dlqyc')}" value="断路器动作时间异常"
					style="font-size:18px;" />
			</f:facet>
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;text-align:center">
			<p:row>
				<p:column style="width:120px;">
					<h:outputLabel value="分析结果:" />
				</p:column>
				<p:column colspan="4">
					<pre align="left"><p:outputLabel value="#{breakerActException.check.analyseResult}" rows="5"
						style="width:100%" /></pre>
				</p:column>
			</p:row>
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;margin-top:10px">
			<f:facet name="header">
			
				<p:row>
					<p:column colspan="5">
						<h:outputText value="检查情况" style="font-size:16px;float:left" />
					</p:column>
				</p:row>
				<p:row>
					<p:column style="width:12%">
						<h:outputText value="检查人员" />
					</p:column>
					<p:column style="width:50%">
						<h:outputText value="检查结果" />
					</p:column>
					<p:column style="width:10%">
						<h:outputText value="检查时间" />
					</p:column>
					<p:column style="width:8%">
						<h:outputText value="是否确认" />
					</p:column>
					<p:column style="width:25%">
						<h:outputText value="附件" />
					</p:column>
				</p:row>
			</f:facet>
			<p:row rendered="#{breakerActException.check!=null}" style="text-align:center">
				<p:column>
					<h:outputText value="#{breakerActException.check.checker}" />
				</p:column>
				<p:column>
					<h:outputText value="#{breakerActException.check.checkResult}" />
				</p:column>
				<p:column>
					<h:outputText value="#{breakerActException.check.checkTime}">
						<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"></f:convertDateTime>
					</h:outputText>
				</p:column>
				<p:column>
					<h:outputText value="#{breakerActException.check.isChecked== true?'是':'否'}" />
				</p:column>
				<p:column style="text-align:left">
					<p:rowExpansion>
						<p:repeat value="#{breakerActException.attachments}" var="file">
							<div class="row" style="padding-left: 10px;">
								<span>#{file.description}</span>
							</div>
						</p:repeat>
					</p:rowExpansion>
				</p:column>
			</p:row>
			<p:row rendered="#{breakerActException.check==null}">
				<p:column colspan="4">
					<h:outputText value="暂无检查信息" />
				</p:column>
			</p:row>
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;text-align:center;margin-top:10px">
			<f:facet name="header">
				<p:row>
					<p:column>
						<h:outputText value="详细信息" style="font-size:16px;float:left" />
					</p:column>
				</p:row>
			</f:facet>
		</p:panelGrid>
		<p:panelGrid columns="6" style="width:100% !important;"
			rendered="#{breakerActException.breakerAct != null}">
			<!-- <f:facet name="header">
				<h:outputText
					rendered="#{breakerActException.msgType.equals('xhsjyc')}"
					value="断路器熄弧时间异常" style="font-size:18px;" />
				<h:outputText
					rendered="#{breakerActException.msgType.equals('gzdlgldyc')}"
					value="故障电流过零异常" style="font-size:18px;" />
				<h:outputText
					rendered="#{breakerActException.msgType.equals('dlqyc')}"
					value="断路器动作时间异常" style="font-size:18px;" />
			</f:facet> -->
			<h:outputText value="断路器名称：" />
			<h:outputText value="#{breakerActException.breakerAct.breakerName}" style="color:blue;" />
			<h:outputText value="厂站名称：" />
			<h:outputText value="#{breakerActException.breakerAct.stationName}" style="color:blue;" />
			<h:outputText value="线路名称：" />
			<h:outputText value="#{breakerActException.breakerAct.lineName}" style="color:blue;" />
			<h:outputText value="故障时间：" />
			<h:outputText value="#{breakerActException.breakerAct.faultTime}" style="color:blue;" />
			<h:outputText value="相别：" />
			<h:outputText value="#{breakerActException.breakerAct.phase}" style="color:blue;" />
			<h:outputText value="动作时间(ms)：" />
			<h:outputText style="color:#{breakerActException.msgType.equals('dlqyc')?'red':'blue'};"
				value="#{breakerActException.breakerAct.actionTimeInterval/1000}">
			</h:outputText>
			<h:outputText value="熄弧时间(ms)：" />
			<h:outputText style="color:#{breakerActException.msgType.equals('xhsjyc')?'red':'blue'};"
				value="#{breakerActException.breakerAct.xhTimeInterval/1000 gt 0?breakerActException.breakerAct.xhTimeInterval/1000:''}" />
			<h:outputText value="过零点时间(ms)：" />
			<h:outputText value="超出采样点范围" style="color:red;"
				rendered="#{breakerActException.msgType.equals('gzdlgldyc') &amp;&amp; breakerActException.breakerAct.cross0Time ge 200000}" />
			<h:outputText
				rendered="#{(breakerActException.msgType.equals('gzdlgldyc') &amp;&amp; breakerActException.breakerAct.cross0Time lt 200000) or breakerActException.msgType.equals('dlqyc') or breakerActException.msgType.equals('xhsjyc')}"
				style="color:#{breakerActException.msgType.equals('gzdlgldyc')?'red':'blue'};"
				value="#{breakerActException.breakerAct.cross0Time/1000 gt 0?breakerActException.breakerAct.cross0Time/1000:''}" />
			<h:outputText value="故障最大电流(kA)：" />
			<h:outputText style="color:blue;"
				value="#{breakerActException.formatNumber(breakerActException.breakerAct.faultValueMax)}" />
		</p:panelGrid>

		<p:panel header="波形" style="text-align:center;font-size:18px" id="wavePanel">
			<!-- <div id="wave" style="height: 600px; width: 100%"></div> -->
			<iframe src="" id="wavePage" frameborder="0" scrolling="no" width='100%' height="600px"></iframe>
		</p:panel>
		<h:inputHidden id="recordId" value="#{request.getParameter('recordId')}" />
	</ui:define>
	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/categoryLineChart.js"></script>
		<script>
			$(function() {
				var fileId = "#{breakerActException.breakerAct.faultFileId}";
				var breakerId = "#{breakerActException.breakerAct.breakerId}";
				var phase = "#{breakerActException.breakerAct.phase}";
				var actTime = "#{breakerActException.breakerAct.twTime}";
				var removeTime = "#{breakerActException.breakerAct.analogFirstActionTime}";
				var xhTime = "#{breakerActException.breakerAct.xhTimeInterval}";
				var cross0Time = "#{breakerActException.breakerAct.cross0Time}";
				var exceptionType = "#{breakerActException.msgType}";
                var actionTimeInterval = "#{breakerActException.breakerAct.actionTimeInterval}";
				
				var link = "/ui/wave/breakerWave.xhtml?fileId=" + fileId
						+ "&amp;breakerId=" + breakerId + "&amp;phase=" + phase
						+ "&amp;actTime=" + actTime + "&amp;removeTime="
						+ removeTime+ "&amp;xhTime="+ xhTime + "&amp;exceptionType="+ exceptionType+"&amp;cross0Time="+ cross0Time
						+"&amp;actionTimeInterval="+actionTimeInterval;
				getProtectActTime(link, fileId, phase);
			});
				
			function getProtectActTime(link, fileId, phase) {
				//点击左侧列表，根据fileId和phase，获取最早的保护动作时间
				$.getJSON('/rest/waveData/getMinProtectActTime/' + fileId + "/"
						+ phase, function(result) {
					link = link + "&amp;protectAct=" + result;
					$('#wavePage').attr('src', link);
				})
			}
			function resizeHtml() {
				var waveframe = document.getElementById('wavePage').contentWindow;
				if(waveframe &amp;&amp; waveframe.resizeHtml){
					waveframe.resizeHtml();
				}
			}
		</script>
	</ui:define>
</ui:composition>
